<template>
  <div class="app-container">
    <el-table
      :data="nodes"
      style="width: 100%"
      row-key="id"
      border
      lazy
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
    >
      <el-table-column prop="name" label="部门名称" width="180"> </el-table-column>
      <el-table-column label="部门状态" width="120">
        <template slot-scope="scope">
            <el-tag type="success" v-if="scope.row.status === 1">正常</el-tag>
            <el-tag type="danger" v-if="scope.row.status === 0">禁用</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="leader" label="部门负责人"></el-table-column>
      <el-table-column prop="phone" label="联系电话"></el-table-column>
      <el-table-column prop="createTime" label="创建时间"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
            <el-button size="small" @click="handleEdit(scope.row)">修改</el-button>
            <el-button size="small" @click="handDelete(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
    import * as api from '@/api/system/dept/dept'
    export default {
        data(){
            return {
                nodes:[],
                load: true
            }
        },
        created(){
            this.fetchData()
        },
        methods:{
            fetchData(){
                api.findNodes()
                .then(response=>{
                    this.nodes = response.data
                })
                .catch(response=>{
                    
                })
            }
        }
    }
</script>
<style scoped></style>
